#include <CamDriver.hpp>

CamDriver::CamDriver(int device)
{
	m_cap = new cv::VideoCapture(device);

	if(!m_cap->isOpened())
	{
		std::cout << "file : " << __FILE__ << " at line " << __LINE__ 
			<< " error : capture device not loaded" << std::endl;
		return;
	}
}

void CamDriver::update()
{
	if(m_cap->isOpened()) {
		cv::Mat frame;
		*m_cap >> frame;
		img << frame;	
	} else {
		throw std::string("Cannot open the camera device !");
	}
}
